/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.vnf.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "VNF_ORDEN_PAGO")
@NamedQueries({@NamedQuery(name = "OrdenPago.findAll", query = "SELECT o FROM OrdenPago o"), @NamedQuery(name = "OrdenPago.findByIdOrdenPago", query = "SELECT o FROM OrdenPago o WHERE o.idOrdenPago = :idOrdenPago"), @NamedQuery(name = "OrdenPago.findByEstado", query = "SELECT o FROM OrdenPago o WHERE o.estado = :estado")})
public class OrdenPago implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_ORDEN_PAGO")
    private Long idOrdenPago;
    @Column(name = "ESTADO")
    private Boolean estado;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "ordenPago", fetch = FetchType.LAZY)
    private TransaccionNoFinanciera transaccionNoFinanciera;

    public OrdenPago() {
    }

    public OrdenPago(Long idOrdenPago) {
        this.idOrdenPago = idOrdenPago;
    }

    public Long getIdOrdenPago() {
        return idOrdenPago;
    }

    public void setIdOrdenPago(Long idOrdenPago) {
        this.idOrdenPago = idOrdenPago;
    }

    public Boolean getEstado() {
        return estado;
    }

    public void setEstado(Boolean estado) {
        this.estado = estado;
    }

    public TransaccionNoFinanciera getTransaccionNoFinanciera() {
        return transaccionNoFinanciera;
    }

    public void setTransaccionNoFinanciera(TransaccionNoFinanciera transaccionNoFinanciera) {
        this.transaccionNoFinanciera = transaccionNoFinanciera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOrdenPago != null ? idOrdenPago.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrdenPago)) {
            return false;
        }
        OrdenPago other = (OrdenPago) object;
        if ((this.idOrdenPago == null && other.idOrdenPago != null) || (this.idOrdenPago != null && !this.idOrdenPago.equals(other.idOrdenPago))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vnf.be.OrdenPago[idOrdenPago=" + idOrdenPago + "]";
    }

}
